﻿using LoveNote.Application.Share.Login;
using LoveNote.Application.Share.Shell;
using LoveNote.Database.Entities;
using LoveNote.Shell.Views;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using TookKit.Mvvm.Attributes;
using TookKit.Mvvm.Bindings;
using TookKit.Mvvm.Enums;

namespace LoveNote.Shell.Services
{
    [DependencyInjection(Lifetime.Singleton, typeof(ISession))]
    class Session : ObservableObject, ISession
    {
        private string title = "爱记™信息管理系统";
        public string Title { get => title; set => SetProperty(ref title, value); }

        private UserEntity user = new UserEntity();
        public UserEntity CurrentUser { get => user; set => SetProperty(ref user, value); }
        public Window MainWindow { get ; set ; }
        public IShellManager ShellManager { get; }
        public Session(IShellManager shellManager)
        {
            ShellManager = shellManager;
        }

        public bool? Show(string content, MessageBoxButton messageBoxButton)
        {
            bool? result = false;
            MainWindow.Dispatcher.Invoke(() =>
            {
                result = new DialogView(content, messageBoxButton, ShellManager).ShowDialog();
            });    
            return result;
        }
    }
}
